﻿#if FRAMEWORK_35
using System;
using System.Collections.Generic;
using System.Text;

using System.IO;

using System.Xml;

using VisualEditor.Objects;

namespace VisualEditor.IO
{
    class AthenaXMLWriter : IModelWriter
    {


        public AthenaXMLWriter(Stream oStream)
        {
            Stream = oStream;
        }

        public override void WriteModel(System.IO.Stream oStream, Model oModel)
        {
            XmlWriterSettings oSettings = new XmlWriterSettings();
            oSettings.Indent = true;
            
            XmlWriter oWriter = XmlWriter.Create(oStream, oSettings);
            

            oWriter.WriteStartElement("athena");
            
            oWriter.WriteAttributeString("version", "1.0");

            oWriter.WriteStartElement("listOfDrawables");

            foreach (IDrawable d in oModel.Drawables)
                d.WriteToXML(oWriter);

            oWriter.WriteEndElement(); // list of drawables
            oWriter.WriteEndElement(); // athena

            oWriter.Flush();
            oWriter.Close();
        }
    }
}
#endif